package com.cloudcc.mobile.dialog;

import android.app.Dialog;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;

import com.cloudcc.mobile.R;

public class HelpDialog {
	private Context mContext;
	private Dialog dialog;

	public HelpDialog(Context mContext) {
		this.mContext = mContext;
	}

	public Dialog createHelpHome() {
		dialog = new Dialog(mContext, R.style.DialogStyle);
		dialog.setContentView(R.layout.dialogweitie);
		dialog.setCancelable(false);
		dialog.getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT,
				ViewGroup.LayoutParams.MATCH_PARENT);
		return dialog;
	}

	public void homeClick(View.OnClickListener listener) {
		if (listener != null) {
			ImageView view = (ImageView) dialog
					.findViewById(R.id.dialog_weitie);
			if (view != null) {
				view.setOnClickListener(listener);
			}
		}
	}

	public Dialog createHelpMessage() {
		dialog = new Dialog(mContext, R.style.DialogDimDisableStyle);
		dialog.setContentView(R.layout.dialog_message);
		dialog.setCancelable(false);
		dialog.getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT,
				ViewGroup.LayoutParams.MATCH_PARENT);
		return dialog;
	}

	public void MessageClick(View.OnClickListener listener) {
		if (listener != null) {
			ImageView view = (ImageView) dialog
					.findViewById(R.id.dialog_message_click);
			if (view != null) {
				view.setOnClickListener(listener);
			}
		}
	}

	public Dialog createHelpMenu() {
		dialog = new Dialog(mContext, R.style.DialogDimDisableStyle);
		dialog.setContentView(R.layout.dialog_menu);
		dialog.setCancelable(false);
		dialog.getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT,
				ViewGroup.LayoutParams.MATCH_PARENT);
		return dialog;
	}

	public void menuClick(View.OnClickListener listener) {
		if (listener != null) {
			ImageView view = (ImageView) dialog
					.findViewById(R.id.dialog_menu_click);
			if (view != null) {
				view.setOnClickListener(listener);
			}
		}
	}

	public Dialog createHelpTop() {
		dialog = new Dialog(mContext, R.style.DialogDimDisableStyle);
		dialog.setContentView(R.layout.dialog_top);
		dialog.setCancelable(false);
		dialog.getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT,
				ViewGroup.LayoutParams.MATCH_PARENT);
		return dialog;
	}

	public Dialog createHelpAdd() {
		dialog = new Dialog(mContext, R.style.DialogDimDisableStyle);
		dialog.setContentView(R.layout.dialogadd);
		dialog.setCancelable(false);
		dialog.getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT,
				ViewGroup.LayoutParams.MATCH_PARENT);
		return dialog;
	}

	public void AddClick(View.OnClickListener listener) {
		if (listener != null) {
			ImageView view = (ImageView) dialog
					.findViewById(R.id.dialog_xinjian);
			if (view != null) {
				view.setOnClickListener(listener);
			}
		}
	}

	public void TopClick(View.OnClickListener listener) {
		if (listener != null) {
			ImageView view = (ImageView) dialog
					.findViewById(R.id.dialog_top_click);
			// Button view = (Button) dialog.findViewById(R.id.tixing);
			if (view != null) {
				view.setOnClickListener(listener);
			}
		}
	}

	public void TopNoFirstClick(View.OnClickListener listener) {
		if (listener != null) {
			// ImageView view = (ImageView)
			// dialog.findViewById(R.id.dialog_top_click);
			Button view = (Button) dialog.findViewById(R.id.tixing);
			if (view != null) {
				view.setOnClickListener(listener);
			}
		}
	}
}
